package com.ruoyi.life.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.life.mapper.FeOfficeMapper;
import com.ruoyi.omp.api.domain.FeOffice;
import com.ruoyi.life.service.IFeOfficeService;

/**
 * 厂房/办公楼费用Service业务层处理
 *
 * @author cjie
 * @date 2021-09-17
 */
@Service
public class FeOfficeServiceImpl implements IFeOfficeService {
    @Autowired
    private FeOfficeMapper feOfficeMapper;

    /**
     * 查询厂房/办公楼费用
     *
     * @param id 厂房/办公楼费用ID
     * @return 厂房/办公楼费用
     */
    @Override
    public FeOffice selectFeOfficeById(String id) {
        return feOfficeMapper.selectFeOfficeById(id);
    }

    /**
     * 查询厂房/办公楼费用列表
     *
     * @param feOffice 厂房/办公楼费用
     * @return 厂房/办公楼费用
     */
    @Override
    public List<FeOffice> selectFeOfficeList(FeOffice feOffice) {
        return feOfficeMapper.selectFeOfficeList(feOffice);
    }

    /**
     * 新增厂房/办公楼费用
     *
     * @param feOffice 厂房/办公楼费用
     * @return 结果
     */
    @Override
    public int insertFeOffice(FeOffice feOffice) {
        feOffice.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        feOffice.setCreateTime(DateUtils.getNowDate());
        feOffice.setCreateBy(SecurityUtils.getUsername());
        return feOfficeMapper.insertFeOffice(feOffice);
    }

    /**
     * 修改厂房/办公楼费用
     *
     * @param feOffice 厂房/办公楼费用
     * @return 结果
     */
    @Override
    public int updateFeOffice(FeOffice feOffice) {
        feOffice.setUpdateTime(DateUtils.getNowDate());
        feOffice.setUpdateBy(SecurityUtils.getUsername());
        return feOfficeMapper.updateFeOffice(feOffice);
    }

    /**
     * 批量删除厂房/办公楼费用
     *
     * @param ids 需要删除的厂房/办公楼费用ID
     * @return 结果
     */
    @Override
    public int deleteFeOfficeByIds(String[] ids) {
        return feOfficeMapper.deleteFeOfficeByIds(ids);
    }

    /**
     * 删除厂房/办公楼费用信息
     *
     * @param id 厂房/办公楼费用ID
     * @return 结果
     */
    @Override
    public int deleteFeOfficeById(String id) {
        return feOfficeMapper.deleteFeOfficeById(id);
    }
}
